import request from "@/utils/request"

//根据token分页查看预约表（前台后台通用）
export function getBookCourseList(page, limit, data) {
  return request({
    method: 'POST',
    url: `/cmsservice/cms-book-course/getBookCourseList/${page}/${limit}`,
    headers: {
      'Content-Type': 'application/json'
    },
    data
  }).then(res => res.data)
}

//用户根据时间查找空闲教室
export function getEmptyCourseList(data) {
  return request({
    method: 'POST',
    url: `/cmsservice/cms-book-course/getEmptyCourseList`,
    headers: {
      'Content-Type': 'application/json'
    },
    data
  }).then(res => res.data)
}

//根据用户新增token预约教室信息
export function addCourse(data) {
  return request({
    method: 'POST',
    url: `/cmsservice/cms-book-course/addCourse`,
    headers: {
      'Content-Type': 'application/json'
    },
    data
  }).then(res => res.data)
}

//根据id删除预约信息
export function deleteCourseById(id) {
  return request({
    method: 'DELETE',
    url: `/cmsservice/cms-book-course/deleteCourseById/${id}`,
    headers: {
      'Content-Type': 'application/json'
    },
  }).then(res => res.data)
}

//管理员根据id审核教室预约申请表
export function updateCourseStatus(id, data) {
  return request({
    method: 'POST',
    url: `/cmsservice/cms-book-course/updateCourseStatus/${id}`,
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

//管理员根据id审核教室预约申请表
export function getStatus() {
  return request({
    method: 'GET',
    url: `/cmsservice/cms-book-course/getStatus`,
  }).then(res => res.data)
}
